#ifndef WORD_H
#define WORD_H

#include <QString>

enum 单词类型 {
    标识符,
    保留字,
    无符号整数,
    单字符分界符,
    双字符分界符,
    注释头符,
    注释尾符,
    字符串起始结束符,
    数组下标界限符,
    空格,
    未知
};
enum _variety_word {
    _identifier,
    _keyword,
    _unsigned_int,
    _delimiter_single_char,
    _delimiter_double_char,
    _comment_begin,
    _comment_end,
    _string_delimiter,
    _array_delimiter,
    _blank,
    _unknown
};

class Word
{
public:
    Word();
    Word(_variety_word,QString);
    Word(单词类型,QString);

    _variety_word GetVariety();
    _variety_word GetVariety() const;
    QString GetContent();
    QString GetContent() const;

    void SetVariety(_variety_word);
    void SetVariety(单词类型);
    void SetContent(QString);

    bool operator<(const Word&);
    bool operator<(const Word&) const;
    bool operator==(const Word&);
    bool operator==(const Word&) const;
    bool operator==(QString);
    bool operator==(QString) const;

    QString GetVarietyString_en();
    QString GetVarietyString_en() const;
    QString GetVarietyString_cn();
    QString GetVarietyString_cn() const;

    static _variety_word IntToVariety(int);
    static QString IntToVarietyString_en(int);
    static QString IntToVarietyString_cn(int);
    static _variety_word String_cnToVariety(QString);

    static bool ReadOnly(_variety_word);
    static bool ReadOnly(单词类型);

private:
    _variety_word variety;  // 单词种类
    QString content;    // 单词内容
    static unsigned readOnly;   // 表示只读，类型小于其的均为只读
    static _variety_word arrWord[11];
    static QString strVariety_en[11],strVariety_cn[11];

};

using Token = std::pair<int,Word>;
using TokenList = QVector<Token>;

#endif // WORD_H
